import javax.swing.text.PasswordView;

public class LOGIN {
    public String name="bit";//用户名；
    public String passWord="333";//密码；
    public  void  loginInfo(String name,String passWord)throws NameException,PasswordException{
        if(!this.name.equals(name)){
            throw new NameException("名字出错异常");
        }
        if(!this.passWord.equals(passWord)){
            throw new PasswordException("密码错误异常");
        }
    }
    public static void main(String[] args){
        LOGIN login=new LOGIN();
        try{
            login.loginInfo("bit","344");
        }catch(NameException E){
            E.printStackTrace();
            System.out.println("捕获了姓名错误异常");
        }catch(PasswordException e){
            e.printStackTrace();
            System.out.println("捕获了密码错误异常");
        }
    }


}
